﻿using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
using TL_Cloud.Core.Entities;

namespace TL_Cloud.Models.BookShop
{
    public partial class Bk_Collect : BaseEntity
    {
        public string CollectId { get; set; }
        public string BookId { get; set; }
 
        public string CollectUserId { get; set; }
        public string CollectUserName { get; set; }

        public virtual Bk_Info bookInfo { get; set; }
 

        public override void Create(string userId,string userName)
        {
            this.CollectId = Guid.NewGuid().ToString();
            this.CreateDate = DateTime.Now;
            this.CollectUserId = userId;
            this.CollectUserName = userName;
        }
        public override void Modify(string userId, string userName)
        {
            
        }

        public override void Mapping(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Bk_Collect>(entity =>
            {
                entity.HasKey(e => e.CollectId);

                entity.ToTable("BK_Collect");

                entity.Property(e => e.CollectId)
                    .HasMaxLength(50)
                    .IsUnicode(false)
                    .ValueGeneratedNever();

                entity.Property(e => e.BookId)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.CreateDate).HasColumnType("datetime");

                entity.Property(e => e.CollectUserId)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.CollectUserName)
                    .HasMaxLength(50)
                    .IsUnicode(false); 
            });
        }
    }
}
